//
//  Category_Goods_TableViewCell.swift
//  Pods
//
//  Created by eme on 2017/4/10.
//
//

import UIKit
import RickonCore
import BrandonCore

class Category_Goods_TableViewCell: UITableViewCell {
    
    @IBOutlet weak var goods_ImageView: UIImageView!    //商品图片
    
    @IBOutlet weak var goods_NameLabel: UILabel!        //商品名称
    
    @IBOutlet weak var goods_BrandLabel: UILabel!       //商品品牌
    
    @IBOutlet weak var goods_priceLabel: UILabel!       //商品价格
    
    @IBOutlet weak var add_PHD_Button: UIButton!        //加入铺货单按钮
    
    @IBOutlet weak var failure_ImageView: UIImageView!  //失效/售罄图片
    
    @IBOutlet weak var lineView: UIView!
    
    @IBOutlet weak var IconImageView: UIImageView!
    var item:CategoryGoodModel?{
        didSet{
            if let model = item{
                self.goods_ImageView.setUrlImage(model.img1)
                self.goods_NameLabel.text = model.pdname
                self.goods_BrandLabel.text = model.brname
                self.IconImageView.image = UIImage(named: AppData.setJINorLinIcon(), in: SansaCore.bundle, compatibleWith: nil)
                self.goods_priceLabel.text = AppData.getFinalShowPrice(jinPrice: model.minshprice, lingPrice: model.bdprice).getPriceStr()
                if model.stock == 0{
                    self.add_PHD_Button.isEnabled = false
                    self.failure_ImageView.image = UIImage(named: "sellout", in: SansaCore.bundle, compatibleWith: nil)
                }else{
                    self.add_PHD_Button.isEnabled = true
                    self.failure_ImageView.image = UIImage(named: "")
                }
            }
        }
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        self.lineView.backgroundColor = Theme.v.separate_Line
        goods_NameLabel.normal_fontSize(14)
        goods_BrandLabel.normal_fontSize(13)
        goods_priceLabel.bold_fontSize(14)
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
